<ul id="busTree" class="ztree"></ul>
<script type="text/javascript">
	var setting = {  
	        data: {  
	            simpleData: {  
	                enable: true  
	            }  
	        },
	        async: {
	            enable: true,
	            contentType: "application/json; charset=utf-8",
				dataType: "json",
	            url: "../../tbl_area/ztree",
	            autoParam:["id", "name", "level"],
	            otherParam:{"otherParam":"zTreeAsyncTest"},
	            dataFilter: filter
	        },
	        callback: {
				beforeClick: function(treeId, treeNode) {
				},
				onClick:function( event,treeId,treeNode ){
					searchWithCity( treeNode.id );
				},
				onCheck:function(event,treeId,treeNode){
				}
			}
	};  
	function filter(treeId, parentNode, childNodes) {
	    if (!childNodes.data) return null;
	    for (var i=0, l=childNodes.data.length; i<l; i++) {
	    	childNodes.data[i].name = childNodes.data[i].name.replace(/\.n/g, '.');
	    	childNodes.data[i].id = childNodes.data[i].code;
	    	childNodes.data[i].pId = childNodes.data[i].p_code;
	    	childNodes.data[i].iconSkin = childNodes.data[i].iconSkin.replace("close","docu")
	    }
	    return childNodes.data;
	}
	var zNodes = new Array();
	/*树形数据写死，从这开始*/
	//setting = {};
	
    $(".sm-left>.tree").niceScroll({
        cursorcolor:"#999",
        cursoropacitymax:1,
        touchbehavior:false,
        cursorwidth:"6px",
        cursorborder:"0",
        cursorborderradius:"5px",
        autohidemode:false,
    })
    
    $(document).ready( function(){
    	//以后改到后台去一次性取出来
    	var url = "../../tbl_area/code/" + global.system_city_code;
		$.getJSON(url, null, function(json){
			//向页面上加载信息
			if( json && json.data ){
				var area_info = json.data;
				zNodes =[
		            { id: area_info.area_code, name:area_info.area_name,iconSkin:"myTree-level1", isParent:false, open:true}
		        ];
				zTreeObj = $.fn.zTree.init( $("#busTree"), setting, zNodes );
				
				showProjectTable( area_info.area_code );
			}else{
				showProjectTable("999999");
			}
		});
    	
	});
</script>